package com.ziq.zcamp.constant

import android.graphics.Color
import com.ziq.zcamp.R

class Constants {
}
enum class MerchantCouponType(val value: Int) {

    /**
     * 若选择折扣券，展示「订单金额满x元」、「折扣x折」、「最高可抵扣x元」填写项
     */
    Discount(2),

    /**
     * 若选择满减券，展示「订单金额满x元」、「可抵用x元」填写项
     */
    Reduction(1)
}
enum class MerchantType {// 商户类型：1营地商户,2活动商户,3综合商户。
    /**
     * 1营地商户
     */
    camp(1),
    /**
     * 2活动商户
     */
    act(2),
    /**
     * 3综合商户  3.14 后弃用
     */
    combine(3);

    var value:Int

    constructor(value: Int){
        this.value = value
    }
}

enum class PlaceSortType {
    /**
     * 距离优先
     */
    Distance(1, "距离优先"),
    /**
     * 人气优先
     */
    Popularity(2, "人气优先"),
    /**
     * 好评优先
     */
    GoodEvaluation(3, "好评优先");

    var type:Int
    var label:String

    constructor(type: Int, label: String){
        this.type = type
        this.label = label
    }
}

enum class FollowRelation {

    /**
     * 互相关注
     */
    mutual("mutual"),
    /**
     * 关注
     */
    following("following"),
    /**
     * 被关注
     */
    befollow("befollow"),
    /**
     * 无关系
     */
    none("null"),

    /**
     * 自己
     */
    self("self");


    var value:String

    constructor(value: String){
        this.value = value
    }

    companion object {
        fun updateRelationUI(relation : String, callback: (isVisible:Boolean, isFollowing:Boolean, statusText:Int, statusTextColor:Int) -> Unit){
            when(relation){
                mutual.value -> {
                    callback.invoke(true,true, R.string.mutual_follow, Color.parseColor("#C5BFBB"))
                }
                following.value -> {
                    callback.invoke(true,true, R.string.followed, Color.parseColor("#C5BFBB"))
                }
                FollowRelation.self.value -> {
                    callback.invoke(false,false, R.string.follow, Color.parseColor("#FFFFFF"))
                }
                else -> {
                    callback.invoke(true,false, R.string.follow, Color.parseColor("#FFFFFF"))
                }
            }
        }

        fun getRelationForFollow(relation: String): String {
            return if (relation == befollow.value) {
                mutual.value
            } else {
                following.value
            }
        }

        fun getRelationForUnFollow(relation : String) :String{
            var relationResult = relation
            if(relation == mutual.value){
                relationResult = befollow.value
            } else if(relation == following.value){
                relationResult = none.value
            }
            return relationResult
        }
    }
}